package zero.entity;

import java.util.List;

/**
 * 产生式
 * 
 * @author Zero
 *
 */
public class Production {
    public static final String START = "start";

    private Integer            number;
    private String             left;
    private List<String>       right;

    public Production() {

    }

    public Production(Integer number, String left, List<String> right) {
        this.number = number;
        this.left   = left;
        this.right  = right;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Production)) {
            return false;
        }

        Production o = (Production) obj;

        return number == o.getNumber();
    }

    @Override
    public String toString() {
        StringBuffer buf = new StringBuffer(left + " ➝");

        for (String s : right) {
            buf.append(" ").append(s);
        }

        return buf.toString();
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getLeft() {
        return left;
    }

    public void setLeft(String left) {
        this.left = left;
    }

    public List<String> getRight() {
        return right;
    }

    public void setRight(List<String> right) {
        this.right = right;
    }
}
